← Index
NYTProf Performance Profile   
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:58 2013

Filename(eval 1149)[/usr/share/perl/5.10/CGI.pm:869]
StatementsExecuted 74 statements in 584µs
Eval Invoked At/usr/share/perl/5.10/CGI.pm line 869
Sibling evals1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111493µs2.85msCGI::::headerCGI::header
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
# spent 2.85ms (493µs+2.36) within CGI::header which was called: # once (493µs+2.36ms) by C4::Output::output_with_http_headers at line 832 of CGI.pm
package CGI; sub header {
216µs112µs my($self,@p) = self_or_default(@_);
# spent 12µs making 1 call to CGI::self_or_default
31300ns my(@header);
4
513µs return "" if $self->{'.header_printed'}++ and $HEADERS_ONCE;
6
7116µs1497µs my($type,$status,$cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) =
# spent 497µs making 1 call to CGI::Util::rearrange
8 rearrange([['TYPE','CONTENT_TYPE','CONTENT-TYPE'],
9 'STATUS',['COOKIE','COOKIES'],'TARGET',
10 'EXPIRES','NPH','CHARSET',
11 'ATTACHMENT','P3P'],@p);
12
13 # Since $cookie and $p3p may be array references,
14 # we must stringify them before CR escaping is done.
151300ns my @cookie;
1613µs for (ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie) {
17225µs4797µs my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
# spent 790µs making 2 calls to CGI::Cookie::as_string, avg 395µs/call # spent 7µs making 2 calls to UNIVERSAL::isa, avg 4µs/call
1828µs push(@cookie,$cs) if defined $cs and $cs ne '';
19 }
201600ns $p3p = join ' ',@$p3p if ref($p3p) eq 'ARRAY';
21
22 # CR escaping for values, per RFC 822
2312µs for my $header ($type,$status,@cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) {
241416µs if (defined $header) {
25 # From RFC 822:
26 # Unfolding is accomplished by regarding CRLF immediately
27 # followed by a LWSP-char as equivalent to the LWSP-char.
28977µs1827µs $header =~ s/$CRLF(\s)/$1/g;
# spent 19µs making 9 calls to CGI::CORE:regcomp, avg 2µs/call # spent 9µs making 9 calls to CGI::CORE:subst, avg 956ns/call
29
30 # All other uses of newlines are invalid input.
319120µs1844µs if ($header =~ m/$CRLF|\015|\012/) {
# spent 23µs making 9 calls to CGI::CORE:regcomp, avg 3µs/call # spent 21µs making 9 calls to CGI::CORE:match, avg 2µs/call
32 # shorten very long values in the diagnostic
33 $header = substr($header,0,72).'...' if (length $header > 72);
34 die "Invalid header value contains a newline not followed by whitespace: $header";
35 }
36 }
37 }
38
391900ns $nph ||= $NPH;
40
411500ns $type ||= 'text/html' unless defined($type);
42
4317µs125µs if (defined $charset) {
# spent 25µs making 1 call to CGI::charset
44 $self->charset($charset);
45 } else {
46 $charset = $self->charset if $type =~ /^text\//;
47 }
481700ns $charset ||= '';
49
50 # rearrange() was designed for the HTML portion, so we
51 # need to fix it up a little.
5212µs for (@other) {
53 # Don't use \s because of perl bug 21951
54444µs426µs next unless my($header,$value) = /([^ \r\n\t=]+)=\"?(.+?)\"?$/s;
# spent 26µs making 4 calls to CGI::CORE:match, avg 6µs/call
554124µs16490µs ($_ = $header) =~ s/^(\w)(.*)/"\u$1\L$2" . ': '.$self->unescapeHTML($value)/e;
# spent 422µs making 1 call to CGI::AUTOLOAD # spent 48µs making 3 calls to CGI::unescapeHTML, avg 16µs/call # spent 10µs making 4 calls to CGI::CORE:subst, avg 2µs/call # spent 10µs making 8 calls to CGI::CORE:substcont, avg 1µs/call
56 }
57
5816µs1900ns $type .= "; charset=$charset"
# spent 900ns making 1 call to CGI::CORE:match
59 if $type ne ''
60 and $type !~ /\bcharset\b/
61 and defined $charset
62 and $charset ne '';
63
64 # Maybe future compatibility. Maybe not.
6512µs my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0';
661300ns push(@header,$protocol . ' ' . ($status || '200 OK')) if $nph;
671200ns push(@header,"Server: " . &server_software()) if $nph;
68
6912µs push(@header,"Status: $status") if $status;
701300ns push(@header,"Window-Target: $target") if $target;
711200ns push(@header,"P3P: policyref=\"/w3c/p3p.xml\", CP=\"$p3p\"") if $p3p;
72 # push all the cookies -- there may be several
73168µs push(@header,map {"Set-Cookie: $_"} @cookie);
74 # if the user indicates an expiration time, then we need
75 # both an Expires and a Date header (so that the browser is
76 # uses OUR clock)
771400ns push(@header,"Expires: " . expires($expires,'http'))
78 if $expires;
7917µs1116µs push(@header,"Date: " . expires(0,'http')) if $expires || $cookie || $nph;
# spent 116µs making 1 call to CGI::Util::expires
80112µs1262µs push(@header,"Pragma: no-cache") if $self->cache();
# spent 262µs making 1 call to CGI::AUTOLOAD
811400ns push(@header,"Content-Disposition: attachment; filename=\"$attachment\"") if $attachment;
8217µs push(@header,map {ucfirst $_} @other);
8312µs push(@header,"Content-Type: $type") if $type ne '';
8415µs my $header = join($CRLF,@header)."${CRLF}${CRLF}";
8511µs if (($MOD_PERL >= 1) && !$nph) {
86 $self->r->send_cgi_header($header);
87 return '';
88 }
89112µs return $header;
90}
91
92;